//
//  HomeNewSpaperView.m
//  SHOP
//
//  Created by L on 2017/10/12.
//  Copyright © 2017年 L. All rights reserved.
//

#import "HomeNewSpaperView.h"

@implementation HomeNewSpaperView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{
    self.backgroundColor = [UIColor colorWithRed:237/255.0 green:237/255.0 blue:237/255.0 alpha:1];
    
    UIView *dayView = [[UIView alloc] init];
    dayView.backgroundColor = [UIColor whiteColor];
    dayView.layer.cornerRadius = 15;
    dayView.layer.masksToBounds = YES;
    [self addSubview:dayView];
    [dayView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.offset(15);
        make.right.bottom.offset(-15);
    }];
    
    UIImageView *image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"快报"]];
    [dayView addSubview:image];
    [image mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.left.offset(15);
    }];
    
    UILabel *newLabel = [UILabel makeWithText:@"宝康快报" andTextColor:[UIColor redColor] andTextFont:13];
    [dayView addSubview:newLabel];
    [newLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.left.equalTo(image.mas_right).offset(10);
    }];
    
    UIImageView *recommendImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"荐"]];
    [dayView addSubview:recommendImage];
    [recommendImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.left.equalTo(newLabel.mas_right).offset(20);
    }];
    
    UILabel *seckillLabel = [UILabel makeWithText:@"全场一元秒杀价，赶快抢购吧" andTextColor:[UIColor blackColor] andTextFont:11];
    [dayView addSubview:seckillLabel];
    [seckillLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.left.equalTo(recommendImage.mas_right).offset(10);
    }];
    
    UIButton *button = [[UIButton alloc] init];
    button.titleLabel.font = [UIFont systemFontOfSize:12];
    [button setTitle:@"更多" forState:UIControlStateNormal];
    [button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [dayView addSubview:button];
    [button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.right.offset(-15);
    }];
    [button addTarget:self action:@selector(touchButton:) forControlEvents:UIControlEventTouchUpInside];
}

- (void)touchButton:(UIButton *)sender
{
    
}

@end
